#! /usr/bin/env python3.2
# -*- coding: utf-8 -*-

import os,sys
import multiprocessing, time, signal
import shlex, subprocess

#打开进程列表

proc = subprocess.Popen("tasklist", stdout=subprocess.PIPE, shell = True)
fstream = open("process.txt", 'w')
for line in proc.stdout.readlines():
    str = line.decode(encoding="gbk", errors="strict")
    fstream.write(str)
    #print(str, end='')
    if "pythonw.exe" in str:
        list = str.split()
        #print(list[1])
        os.system("taskkill /PID "+list[1]+" /F")
fstream.close()

input()
